package ma.co.ba.BusinessApplications.model;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name="CONTACTS")
public class Contact implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private int id;

	@Column(name = "NOM", length = 50)
	private String nom;

	@Column(name = "PRENOM", length = 50)
	private String prenom;

	@Column(name = "PHONE", length = 16)
	private String telephone;

	@Column(name = "FAX", length = 16)
	private String fax;

	@Column(name = "ACTIF")
	private boolean actif = true;
	
	@Column(name = "EMAIL1", length = 250)
	private String email1;
	
	@Column(name = "EMAIL2", length = 250)
	private String email2;

	@ManyToOne(cascade = CascadeType.ALL, fetch=FetchType.EAGER)
	private Client client;

	@OneToMany(mappedBy="contact", cascade = CascadeType.ALL, fetch=FetchType.LAZY)
	private List<DAT> dats;

	public Contact() {

	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	

	public String getNom() {
		return nom;
	}

	public void setNom(String nom) {
		this.nom = nom;
	}

	public String getPrenom() {
		return prenom;
	}

	public void setPrenom(String prenom) {
		this.prenom = prenom;
	}

	public String getTelephone() {
		return telephone;
	}

	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}

	public String getFax() {
		return fax;
	}

	public void setFax(String fax) {
		this.fax = fax;
	}

	public String getEmail1() {
		return email1;
	}

	public void setEmail1(String email1) {
		this.email1 = email1;
	}

	public String getEmail2() {
		return email2;
	}

	public void setEmail2(String email2) {
		this.email2 = email2;
	}

	public Client getClient() {
		return client;
	}

	public void setClient(Client client) {
		this.client = client;
	}

	public List<DAT> getDats() {
		return dats;
	}

	public void setDats(List<DAT> dats) {
		this.dats = dats;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public boolean isActif() {
		return actif;
	}

	public void setActif(boolean actif) {
		this.actif = actif;
	}

}